home *** CD-ROM | disk | FTP | other *** search
-
- /* File : clrvwprt.c ( clearviewport ) */
- /* Entered by : A. Wayner */
- # include <graphics.h>
-
- main()
- {
- int graphdriver = DETECT, graphmode;
-
- /* Detect adapter type and initialize */
- /* graphics system */
- initgraph( &graphdriver, &graphmode, "\\turboc" );
- outtextxy( 10, 10, "Press any key to clear viewport");
-
- /* Define a viewport and draw something */
- /* in it */
- setviewport( 100, 50, getmaxx() - 100, getmaxy() - 60, 1 );
-
- /* Draw outline of the viewport */
- rectangle( 0,0, getmaxx() - 200, getmaxy() - 110 );
-
-
- bar( 50, 50, 100, 100 );
- getch();
- clearviewport();
- outtextxy( 10, 10, "Notice only viewport was cleared");
-
- /* Wait until user presses a key */
- outtextxy( 10, getmaxy() - 50, "Press any key to exit");
-
- getch();
- closegraph();
- }
-
-